package com.rpc.demo;

import com.caucho.hessian.client.HessianProxyFactory;
import com.rpc.demo.service.UserService;

import java.net.MalformedURLException;

/*
* 直接启动hessian代理工厂，传入接口和地址得到代理对象，使用目标方法
* */
public class MyClient {
	public static void main(String[] args) throws MalformedURLException {
		String url = "http://localhost:8080/hessianServlet";
		HessianProxyFactory factory = new HessianProxyFactory();
		UserService service = (UserService) factory.create(UserService.class, url);
		String chen = service.sayHello("chen3哥");
		System.out.println(chen);
	}
}
